package com.xzlcPT.service.impl;

import com.github.pagehelper.PageHelper;
import com.util.PageBean;
import com.xzlcPT.bean.XzUser;
import com.xzlcPT.dao.XzUserMapper;
import com.xzlcPT.service.XzUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by Administrator on 2017/9/1.
 */
@Service("userService")
public class XzUserServiceImpl implements XzUserService{

    @Autowired
    private XzUserMapper userMapper;

    @Override
    public int insertUser(XzUser user) {
        return userMapper.insert(user);
    }

    @Override
    public int updateUser(XzUser user) {
        return userMapper.updateByPrimaryKey(user);
    }

    @Override
    public XzUser selUserById(Long id) {
        return userMapper.selectByPrimaryKey(id);
    }

    @Override
    public int deleteUser(Long id) {
        return userMapper.deleteByPrimaryKey(id);
    }

    @Override
    public PageBean<XzUser> selUserAll(int page, int rows, XzUser user) {
        PageHelper.startPage(page,rows);
        List<XzUser> userList = userMapper.selectAll(user);
        return new PageBean<>(userList);
    }
}
